package top.hisoft.pattern.creational.prototype.key;

import top.hisoft.pattern.creational.prototype.key.keys.AluminiumKey;
import top.hisoft.pattern.creational.prototype.key.keys.CopperKey;

public class Client {

    public static void main(String[] args) {

        cloneCopperKey();
        System.out.println("----------------------------------------------------");
        cloneAluminiumKey();
    }

    private static void cloneCopperKey() {
        AbstractKey key = new CopperKey();
        key.setLength(3);
        key.setThick(0.5F);

        AbstractKey clone = (AbstractKey) key.clone();
        clone.setColor("silvery white");

        System.out.println("original: " + key);
        System.out.println("original: " +key.getColor());
        System.out.println("clone: " + clone);
        System.out.println("clone: " +clone.getColor());
    }

    private static void cloneAluminiumKey() {
        AbstractKey key = new AluminiumKey();
        key.setLength(4);
        key.setThick(0.3F);

        AbstractKey clone = (AbstractKey) key.clone();
        clone.setColor("yellow");

        System.out.println("original: " +key);
        System.out.println("original: " +key.getColor());
        System.out.println("clone: " +clone);
        System.out.println("clone: " +clone.getColor());
    }
}
